<template>
  <div class="pagination-container">
    <el-pagination
      background
      layout="total, sizes, prev, pager, next, jumper"
      :current-page.sync="queryInfo.current"
      :page-size="queryInfo.size"
      :page-sizes="pageSize"
      :total="queryInfo.total"
      @size-change="handleSizeChange"
      @current-change="handleCurrentChange"
    />
  </div>
</template>

<script>
export default {
  props: {
    queryInfo: {
      type: Object,
      default: () => {},
    },
    pageSize: {
      type: Array,
      default: () => [10, 20, 30, 50],
    },
    callback: Function,
  },
  components: {},
  data() {
    return {};
  },
  created() {},
  mounted() {},
  methods: {
    // 修改每页条数
    handleSizeChange(val) {
      this.queryInfo.size = val;
      this.callback();
    },
    // 页码切换
    handleCurrentChange(val) {
      this.queryInfo.current = val;
      this.callback();
    },
  },
};
</script>

<style scoped lang="scss">
</style>
